<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function throttle(fn,timeout) {
            let timer=null
            return function(...arg) {
                if(timer)return
                timer=setTimeout(()=>{
                    fn.apply(this,arg)
                    timer=null
                },timeout)
            }
        }
        function debounce(fn,timeout) {
            let timer=null
            return function(...arg) {
                clearTimeout(timer)
                timer=setTimeout(()=>{
                    fn.apply(this,arg)
                },timeout)
            }
        }
    </script>
</body>
</html>